using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for Base
/// </summary>
public class Base
{
    public string[,] Lista = new string[4,5];
    private string Path;

	public Base(string DataBasePath)
	{
		//
		// TODO: Add constructor logic here
		//
        System.IO.StreamReader file = new System.IO.StreamReader(DataBasePath);
        Path = DataBasePath;

        int i = 0;
        char[] delimiterChars = { ';' };
        while (!file.EndOfStream)
        {
            string linea = file.ReadLine();
            string[] lineaSplit = linea.Split(delimiterChars);
            Lista[i, 0] = lineaSplit[0].ToString();
            Lista[i, 1] = lineaSplit[1].ToString();
            Lista[i, 2] = lineaSplit[2].ToString();
            Lista[i, 3] = lineaSplit[3].ToString();
			Lista[i, 4] = lineaSplit[4].ToString();
            i++;
        }
        file.Close();

	}

    public void SaveToFile()
    {
        System.IO.StreamWriter file = new System.IO.StreamWriter(Path,false,System.Text.Encoding.UTF8);
       // System.IO.StreamWriter fileWriter =  System.IO.File.AppendText(Path);
 

        try
        {

            int i = 0;
            for (i = 0; i < 4; i++)
            {
                string linea = Lista[i, 0] + ";" + Lista[i, 1] + ";" + Lista[i, 2] + ";" + Lista[i, 3] + ";" + Lista[i, 4];
                file.WriteLine(linea);
            }
            file.Close();
        }
        catch (Exception e)
        {
            throw new Exception(e.Message);
        }

    }
}
